<?php
namespace Mouta\UserBundle\Type;

use Symfony\Component\DependencyInjection\ContainerInterface;

use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\Exception\FormException;

class Select2Type extends AbstractType
{

    public function getParent()
    {
        return 'text';
    }
    
    public function buildView(FormView $view, FormInterface $form, array $options)
    {
        
            $options['autocomplete'] = 'off';
        
            $view->vars['attr'] = array_merge(array(
                'autocomplete' => $options['autocomplete'],
                'x-autocompletetype' => $options['autocomplete'],
            ), $view->vars['attr']);
        
    }

    public function getName()
    {
        return 'select2';
    }
}
